# coding: utf-8
from dao import db


def model_dict(model):
    if type(model) != dict:
        model = model.__dict__
    return {k: v for k, v in model.items() if not k.startswith('_')}


class City(db.Model):
    __tablename__ = 'city'

    city_id = db.Column(db.BigInteger, primary_key=True)
    city_name = db.Column(db.String(255))
    city_score = db.Column(db.Float)


class Education(db.Model):
    __tablename__ = 'education'

    education_id = db.Column(db.BigInteger, primary_key=True)
    education_name = db.Column(db.String(255))
    education_score = db.Column(db.Float)


class Job(db.Model):
    __tablename__ = 'job'

    job_id = db.Column(db.BigInteger, primary_key=True)
    job_name = db.Column(db.String(255))
    city_id = db.Column(db.BigInteger)
    salary_upper_limit = db.Column(db.Float)
    salary_lower_limit = db.Column(db.Float)
    experience_upper_limit = db.Column(db.Float)
    experience_lower_limit = db.Column(db.Float)
    company = db.Column(db.String(255))
    company_size_upper_limit = db.Column(db.BigInteger)
    company_size_lower_limit = db.Column(db.BigInteger)
    job_score = db.Column(db.Float)


class JobEducation(db.Model):
    __tablename__ = 'job_education'

    job_education_id = db.Column(db.BigInteger, primary_key=True)
    job_id = db.Column(db.BigInteger)
    education_id = db.Column(db.BigInteger)


class JobTech(db.Model):
    __tablename__ = 'job_tech'

    job_tech_id = db.Column(db.BigInteger, primary_key=True)
    job_id = db.Column(db.BigInteger)
    tech_id = db.Column(db.BigInteger)


class JobWelfare(db.Model):
    __tablename__ = 'job_welfare'

    job_welfare = db.Column(db.BigInteger, primary_key=True)
    job_id = db.Column(db.BigInteger)
    welfare_id = db.Column(db.BigInteger)


class Tech(db.Model):
    __tablename__ = 'tech'

    tech_id = db.Column(db.BigInteger, primary_key=True)
    tech_name = db.Column(db.String(255))
    tech_score = db.Column(db.Float)


class Welfare(db.Model):
    __tablename__ = 'welfare'

    welfare_id = db.Column(db.BigInteger, primary_key=True)
    welfare_name = db.Column(db.String(255))
    welfare_score = db.Column(db.Float)
